import React, { useEffect } from 'react';
import { useParams,useNavigate } from 'react-router-dom';
const Index = () => {
    const navigate = useNavigate();
    let params= useParams();
    /* useEffect相当于componentDidMount */
    useEffect(()=>{
        console.log(params)
    })
    return (
        <div>
            detail
            <p><button onClick={()=>{
                navigate(-1)
            }}>跳转回首页</button></p>
        </div>
    );
}

export default Index;
    